<?php
require_once '../sub/init.php';
$currfields = 'sex,grade';
require_once ZEAI.'m/my_chk_u.php';
require_once ZEAI.'cache/config_vip.php';
$urole     = json_decode($_ZEAI['urole']);
$video_num = json_decode($_VIP['video_num']);
$switch    = json_decode($_ZEAI['switch'],true);
$t = (ifint($t,'1-2','1'))?$t:1;
$cook_grade = intval($row['grade']);
$cook_sex   = intval($row['sex']);
require_once ZEAI.'cache/config_up.php';
require_once ZEAI.'sub/zeai_up_func.php';
require_once ZEAI.'sub/ZeaiUP.php';
require_once ZEAI.'cache/udata.php';
switch ($submitok) {
	case 'ajax_video_del':
		if (ifint($id)){
			$row = $db->ROW(__TBL_VIDEO__,"path_s","uid=".$cook_uid." AND id=".$id,"num");
			if ($row){
				$path_s = $row[0];$path_b = str_replace('.jpg','.mp4',$path_s);
				@up_send_userdel($path_s.'|'.$path_b);
				$db->query("DELETE FROM ".__TBL_VIDEO__." WHERE id=".$id);
				json_exit(array('flag'=>1));
			}
		}
		json_exit(array('flag'=>0));
	break;
}
$rt=$db->query("SELECT id,path_s,flag,addtime FROM ".__TBL_VIDEO__." WHERE uid=".$cook_uid." ORDER BY id DESC");
$total = $db->num_rows($rt);
$data_video_num = $total;
$nav='my';?>
<!doctype html><html><head><meta charset="utf-8">
<title><?php echo '我的视频';?></title>
<?php echo HEADMETA; ?>
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo HOST;?>/cache/zeaicolor.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo RES;?>m/css/my_photo_video.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<?php
if (is_weixin()){
	require_once ZEAI."api/weixin/jssdk.php";?>
	<script src="<?php echo RES;?>jweixin-1.2.0.js"></script>
	<script>
	wx.config({debug: false,
		appId: '<?php echo $signPackage["appId"];?>',
		timestamp: <?php echo $signPackage["timestamp"];?>,
		nonceStr: '<?php echo $signPackage["nonceStr"];?>',
		signature: '<?php echo $signPackage["signature"];?>',
		jsApiList: ['chooseImage','uploadImage','previewImage']
	});
	</script>
<?php }?>
<script>var upVMaxMB = <?php echo $_UP['upVMaxMB']; ?>,browser='<?php echo browser();?>',up2='<?php echo $_ZEAI['up2'];?>/',GradeName = '<?php echo utitle($cook_grade); ?>';</script>
<script src="<?php echo RES;?>m/js/ZeaiUP.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<style>
.tabmenu a.ed:after{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
header.bgcolor{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.videoli i.add{color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.6);border-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.2);background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.1)}
.videoli i.add h5{color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.6)}
<?php
if ($_ZEAI['m_mb']==2){
	echo '.tabmenufix{width:70%;max-width:500px;top:1.5rem;margin:auto;left:0;right:0}';
	echo '#ZEAI_CN__FORM{padding-top:5rem}';
	$mini_class='top_mini4';
}else{
	echo '.tabmenufix{top:6.7rem}';
	echo '#ZEAI_CN__FORM{padding-top:10rem}';
	$mini_title='红娘牵线';
	$mini_class='top_mini4 zeaibg bgcolor yunbox';
}
?>
</style>
</head>
<body>
<?php
$jumpurlback = (!empty($jumpurl))?'zeai.openurl(\''.urldecode($jumpurl).'\')':'zeai.openurl(\'my.php\');';
//$mini_class='top_mini4 bgcolor yunbox';
$mini_href =$jumpurlback;
$mini_title='我的视频('.$data_video_num .')';
require_once ZEAI.'m/top_mini.php';?>
<div class="tabmenu tabmenu2 tabmenufix">
	<a href="my_photo.php">个人相册</a>
	<a href="my_video.php" class="ed">个人视频</a>
</div>
<form id="ZEAI_CN__FORM">
<?php switch ($t){case 1:
/*********个人相册*********/?>
	<div class="videoli" id="videoli">
        <i class="add ico" id="btnadd">&#xe68a;<h5>点击上传</h5></i>
        <?php
        if ($total > 0) {
            for($i=1;$i<=$total;$i++) {
                $rows = $db->fetch_array($rt);
                if(!$rows) break;
                $id     = $rows[0];
                $path_s = $rows[1];
                $flag   = $rows[2];
                $addtime= $rows[3];
				if ((ADDTIME - $addtime) > 300){
					$dst_s = UP.$path_s;
					$dst_b = str_replace('.jpg','.mp4',$dst_s);
					$cvs     = '<video class="zeaiVbox" id="zeaiVbox'.$id.'"><source src="'.$dst_b.'">您微信版本太低，请升级</video><div class="play ico">&#xe603;</div>';
					$flagstr = $cvs;
					if(is_h5app()){
						$vplay = 'javascript:app_VideoPlayer("'.$dst_b.'");';
					}else{
						//$vplay = 'javascript:zeaiplay("'.$id.'")';
						$vplay = 'javascript:zeai.openurl("'.mHref('video',$id).'")';
					}
					$ifdel = true;
				}else{
					$dst_s = RES.'videomaking.gif';	
					$dst_b = '';
					$vplay = 'javascript:;';
					$ifdel = false;
				}
				if($flag == 0){
					$flagstr = '<span>审核中</span>';
					$vplay = 'javascript:;';
				}
                $list_str  = '';
				$liid      = 'li'.$id;
                $list_str .= '<i id="'.$liid.'">';
                $list_str .= '<a href='.$vplay.'><img src="'.$dst_s.'">'.$flagstr.'</a>';
				if ($ifdel)$list_str .= '<a href="javascript:;" class="del ico">&#xe62c;</a>';
                $list_str .= '</i>';
                echo $list_str;
            }
        }
		$VcfgMaxnum = $video_num->$cook_grade;?>
    </div>
    <div id="v_vipHelp" class="helpDiv">
        <ul><?php
        foreach ($urole as $uv) {
            $grade = $uv->g;
            $title = $uv->t;
			$ifmy = ($cook_grade==$grade)?'　　<font class="Cf00">（我）</font>':'';
            $out1 .= '<li>'.uicon_grade_all($grade,1,$cook_sex).' '.$title.' <i class="ico">&#xe62d;</i> <font class="Cf00">'.$video_num->$grade.'</font> 张'.$ifmy.'</li>';
        }echo $out1;
        ?></ul>
        <a href="my_vip.php" class="btn size3 HUANG vipbtn"><i class="ico">&#xe6ab;</i> 立即升级</a>
    </div>
    <script>
	<?php if ($data_photo_num>0){?>var pic_list=<?php echo $pic_list;?>;<?php }
			$multiple=$PcfgMaxnum-$data_photo_num;
			$multiple=($multiple<=0)?0:$multiple;
	?>
	var data_video_num=<?php echo $data_video_num;?>,VcfgMaxnum=<?php echo $VcfgMaxnum;?>;
	btnadd.onclick=function(){
		if ( data_video_num >= VcfgMaxnum ){
			ZeaiM.div2({obj:v_vipHelp,title:'【'+GradeName+'】最多只能 '+VcfgMaxnum+' 个视频',w:30,h:32});	
		}else{
			video_up({url:"my_video"+zeai.extname,submitok:"ajax_video_up"});
		}
	}
	zeai.listEach(videoli.getElementsByTagName("i"),function(obj){
		if (zeai.empty(obj.className)){
			var Aarr=obj.getElementsByTagName("a");
			var play=Aarr[0],del =Aarr[1];
			play.onclick=function(){/*photoView(this.src.replace('_s','_b'));*/	}
			if(!zeai.empty(o(del)))del.onclick=function(){
				zeai.alertplus({'title':'确认要删除么？','content':'','title1':'取消','title2':'删除',
					'fn1':function(){zeai.alertplus(0);},
					'fn2':function(){zeai.alertplus(0);PVdel(obj.id.replace('li',''),'ajax_video_del');}
				});
			}
		}
	});
    </script>
	<script src="<?php echo RES;?>m/js/my_photo_video.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<?php break;}?>
</form>
<?php
if($_ZEAI['m_mb']==2){
	require_once ZEAI.'m/bottom2.php';
}else{
	require_once ZEAI.'m/TRnav.php';
	require_once ZEAI.'m/bottom.php';
}
?>